<template>
  <el-menu default-active="2" :collapse="collapsed" collapse-transition router :default-active="$route.path" unique-opened class="el-menu-vertical-demo" background-color="#334157" text-color="#fff" active-text-color="#ffd04b">
    <div class="logobox">
      <img class="logoimg" src="../assets/img/logo.png" alt="">
    </div>
    <el-menu-item :index=" '/charts/statistics' ">
      <i class="el-icon-menu"></i>
      <span slot="title">首页</span>
    </el-menu-item>
    <el-submenu index="2">
      <template slot="title">
        <i class="el-icon-document-copy"></i>
        <span slot="title">博客管理</span>
      </template>
      <el-menu-item-group>
        <el-menu-item :index="'/blog/list'">
          <i class="el-icon-tickets"></i>
          <span>博客列表</span>
        </el-menu-item>
        <el-menu-item :index="'/blog/addBlog'">
          <i class="el-icon-folder-add"></i>
          <span>发表博客</span>
        </el-menu-item>
        <el-menu-item :index="'/category/list'">
          <i class="el-icon-files"></i>
          <span>分类管理</span>
        </el-menu-item>
        <el-menu-item :index="'/label/list'">
          <i class="el-icon-collection-tag"></i>
          <span>标签管理</span>
        </el-menu-item>
      </el-menu-item-group>
    </el-submenu>
    <el-submenu index="1">
      <template slot="title">
        <i class="el-icon-headset"></i>
        <span slot="title">音乐管理</span>
      </template>
      <el-submenu index="1-1">
        <template slot="title">
          <i class="el-icon-service"></i>
          <span slot="title">歌曲管理</span>
        </template>
        <el-menu-item-group>
          <el-menu-item :index="'/music/song'">
            <i class="el-icon-headset"></i>
            <span>歌曲列表</span>
          </el-menu-item>
          <el-menu-item :index="'/music/song/category'">
            <i class="el-icon-s-grid"></i>
            <span>歌曲分类</span>
          </el-menu-item>
        </el-menu-item-group>
      </el-submenu>
      <el-submenu index="1-3">
        <template slot="title">
          <i class="el-icon-s-order"></i>
          <span slot="title">歌单管理</span>
        </template>
        <el-menu-item-group>
          <el-menu-item :index="'/music/songList'">
            <i class="el-icon-document"></i>
            <span>歌单列表</span>
          </el-menu-item>
          <el-menu-item :index="'/music/songList/category'">
            <i class="el-icon-files"></i>
            <span>歌单分类</span>
          </el-menu-item>
        </el-menu-item-group>
      </el-submenu>
      <el-menu-item :index="'/music/singer'">
        <i class="el-icon-s-custom"></i>
        <span slot="title">歌手列表</span>
      </el-menu-item>
      <el-submenu index="1-2">
        <template slot="title">
          <i class="el-icon-video-camera"></i>
          <span slot="title">MV管理</span>
        </template>
        <el-menu-item-group>
          <el-menu-item :index="'/music/mv'">
            <i class="el-icon-aim"></i>
            <span>MV列表</span>
          </el-menu-item>
          <el-menu-item :index="'/music/mv/region'">
            <i class="el-icon-copy-document"></i>
            <span>地区管理</span>
          </el-menu-item>
          <el-menu-item :index="'/music/mv/type'">
            <i class="el-icon-collection-tag"></i>
            <span>类型管理</span>
          </el-menu-item>
        </el-menu-item-group>
      </el-submenu>
    </el-submenu>
    <el-submenu index="5">
      <template slot="title">
        <i class="el-icon-camera"></i>
        <span slot="title">相册管理</span>
      </template>
      <el-menu-item-group>
        <el-menu-item :index="'/picture/list'">
          <i class="el-icon-camera-solid"></i>
          <span>相册列表</span>
        </el-menu-item>
      </el-menu-item-group>
    </el-submenu>
    <el-submenu index="3">
      <template slot="title">
        <i class="el-icon-setting"></i>
        <span slot="title">系统管理</span>
      </template>
      <el-menu-item-group>
        <el-menu-item :index="'/system/user'">
          <i class="el-icon-user"></i>
          <span>用户管理</span>
        </el-menu-item>
        <el-menu-item :index="'/system/Role'">
          <i class="el-icon-user-solid"></i>
          <span>角色管理</span>
        </el-menu-item>
        <el-menu-item :index="'/system/Permission'">
          <i class="el-icon-star-off"></i>
          <span>权限管理</span>
        </el-menu-item>
      </el-menu-item-group>
    </el-submenu>
    <el-submenu index="4">
      <template slot="title">
        <i class="el-icon-guide"></i>
        <span slot="title">网站管理</span>
      </template>
      <el-menu-item-group>
        <el-menu-item :index="'/website/config'">
          <i class="el-icon-setting"></i>
          <span>网站配置</span>
        </el-menu-item>
        <el-menu-item :index="'/website/log'">
          <i class="el-icon-folder-opened"></i>
          <span>日志信息</span>
        </el-menu-item>
        <el-menu-item :index="'/website/comment'">
          <i class="el-icon-edit-outline"></i>
          <span>评论管理</span>
        </el-menu-item>
        <el-menu-item :index="'/website/message'">
          <i class="el-icon-notebook-2"></i>
          <span>留言管理</span>
        </el-menu-item>
        <el-menu-item :index="'/website/opinion'">
          <i class="el-icon-receiving"></i>
          <span>用户反馈</span>
        </el-menu-item>
      </el-menu-item-group>
    </el-submenu>
  </el-menu>
</template>
<script>
import menu from '@/data/menu';
export default {
  name: 'leftnav',
  data() {
    return {
      collapsed: false,
      allmenu: []
    }
  },
  // 创建完毕状态(里面是操作)
  created() {
    // 获取图形验证码
    let res = {
      success: true,
      msg: 'success'
    }
    this.allmenu = menu;
    // 监听
    this.$root.Bus.$on('toggle', value => {
      this.collapsed = !value
    })
  }
}
</script>
<style>
.el-menu-vertical-demo:not(.el-menu--collapse) {
  width: 240px;
  min-height: 400px;
}
.el-menu-vertical-demo:not(.el-menu--collapse) {
  border: none;
  text-align: left;
}
.el-menu-item-group__title {
  padding: 0px;
}
.el-menu-bg {
  background-color: #1f2d3d !important;
}
.el-menu {
  border: none;
}
.logobox {
  height: 40px;
  line-height: 40px;
  color: #9d9d9d;
  font-size: 20px;
  text-align: center;
  padding: 20px 0px;
}
.logoimg {
  height: 40px;
}
</style>
